package com.shrct.businessprocess.customerservice.impl;

import com.shrct.businessprocess.customerservice.RCRoutineService;
import com.shrct.businessprocess.customerservice.RCRoutineServiceDAO;
import com.shrct.businessprocess.customerservice.impl.RCRoutineServiceImpl;
import edu.fudan.mylang.pf.BaseService;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.stereotype.Service;

@Service("com.shrct.businessprocess.customerservice.RCRoutineServiceDAO")
public class RCRoutineServiceDAOImpl extends BaseService implements RCRoutineServiceDAO {
  public RCRoutineService create(final Procedure1<? super RCRoutineService> preInit) {RCRoutineService rCRoutineService=RCRoutineServiceImpl.create(getObjectFactory());
    final Procedure1<RCRoutineService> _function = new Procedure1<RCRoutineService>() {
        public void apply(final RCRoutineService it) {
          preInit.apply(it);
          Integer _serviceDuration = it.getServiceDuration();
          Integer _serviceInterval = it.getServiceInterval();
          int _divide = ((_serviceDuration).intValue() / (_serviceInterval).intValue());
          it.setPlanCount(Integer.valueOf(_divide));
          it.generateRemenders();
        }
      };
    RCRoutineService _doubleArrow = ObjectExtensions.<RCRoutineService>operator_doubleArrow(rCRoutineService, _function);
    return _doubleArrow;
  }
  
  public void delete(final RCRoutineService routineServiceContract) {getObjectFactory().delete(routineServiceContract);
    
  }
}
